"use strict";
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
    if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
    return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrgImage = void 0;
var typeorm_1 = require("typeorm");
var class_validator_1 = require("class-validator");
var organization_entity_1 = require("@/modules/organization/models/organization.entity");
var card_entity_1 = require("@/modules/card/models/card.entity");
/**
 * 机构资源
 */
var OrgImage = function () {
    var _classDecorators = [(0, typeorm_1.Entity)('org_image')];
    var _classDescriptor;
    var _classExtraInitializers = [];
    var _classThis;
    var _id_decorators;
    var _id_initializers = [];
    var _id_extraInitializers = [];
    var _url_decorators;
    var _url_initializers = [];
    var _url_extraInitializers = [];
    var _remark_decorators;
    var _remark_initializers = [];
    var _remark_extraInitializers = [];
    var _orgIdForFront_decorators;
    var _orgIdForFront_initializers = [];
    var _orgIdForFront_extraInitializers = [];
    var _orgIdForRoom_decorators;
    var _orgIdForRoom_initializers = [];
    var _orgIdForRoom_extraInitializers = [];
    var _orgIdForOther_decorators;
    var _orgIdForOther_initializers = [];
    var _orgIdForOther_extraInitializers = [];
    var _cards_decorators;
    var _cards_initializers = [];
    var _cards_extraInitializers = [];
    var OrgImage = _classThis = /** @class */ (function () {
        function OrgImage_1() {
            this.id = __runInitializers(this, _id_initializers, void 0);
            this.url = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _url_initializers, void 0));
            this.remark = (__runInitializers(this, _url_extraInitializers), __runInitializers(this, _remark_initializers, void 0));
            this.orgIdForFront = (__runInitializers(this, _remark_extraInitializers), __runInitializers(this, _orgIdForFront_initializers, void 0));
            this.orgIdForRoom = (__runInitializers(this, _orgIdForFront_extraInitializers), __runInitializers(this, _orgIdForRoom_initializers, void 0));
            this.orgIdForOther = (__runInitializers(this, _orgIdForRoom_extraInitializers), __runInitializers(this, _orgIdForOther_initializers, void 0));
            // 关联消费卡
            this.cards = (__runInitializers(this, _orgIdForOther_extraInitializers), __runInitializers(this, _cards_initializers, void 0));
            __runInitializers(this, _cards_extraInitializers);
        }
        return OrgImage_1;
    }());
    __setFunctionName(_classThis, "OrgImage");
    (function () {
        var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
        _id_decorators = [(0, typeorm_1.PrimaryGeneratedColumn)('uuid')];
        _url_decorators = [(0, typeorm_1.Column)({
                type: 'text',
                comment: '地址',
            }), (0, class_validator_1.IsNotEmpty)()];
        _remark_decorators = [(0, typeorm_1.Column)({
                comment: 'remark',
                nullable: true,
            })];
        _orgIdForFront_decorators = [(0, typeorm_1.ManyToOne)(function () { return organization_entity_1.Organization; }, function (org) { return org.orgFrontImg; })];
        _orgIdForRoom_decorators = [(0, typeorm_1.ManyToOne)(function () { return organization_entity_1.Organization; }, function (org) { return org.orgRoomImg; })];
        _orgIdForOther_decorators = [(0, typeorm_1.ManyToOne)(function () { return organization_entity_1.Organization; }, function (org) { return org.orgOtherImg; })];
        _cards_decorators = [(0, typeorm_1.OneToMany)(function () { return card_entity_1.Card; }, function (card) { return card.org; })];
        __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: function (obj) { return "id" in obj; }, get: function (obj) { return obj.id; }, set: function (obj, value) { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
        __esDecorate(null, null, _url_decorators, { kind: "field", name: "url", static: false, private: false, access: { has: function (obj) { return "url" in obj; }, get: function (obj) { return obj.url; }, set: function (obj, value) { obj.url = value; } }, metadata: _metadata }, _url_initializers, _url_extraInitializers);
        __esDecorate(null, null, _remark_decorators, { kind: "field", name: "remark", static: false, private: false, access: { has: function (obj) { return "remark" in obj; }, get: function (obj) { return obj.remark; }, set: function (obj, value) { obj.remark = value; } }, metadata: _metadata }, _remark_initializers, _remark_extraInitializers);
        __esDecorate(null, null, _orgIdForFront_decorators, { kind: "field", name: "orgIdForFront", static: false, private: false, access: { has: function (obj) { return "orgIdForFront" in obj; }, get: function (obj) { return obj.orgIdForFront; }, set: function (obj, value) { obj.orgIdForFront = value; } }, metadata: _metadata }, _orgIdForFront_initializers, _orgIdForFront_extraInitializers);
        __esDecorate(null, null, _orgIdForRoom_decorators, { kind: "field", name: "orgIdForRoom", static: false, private: false, access: { has: function (obj) { return "orgIdForRoom" in obj; }, get: function (obj) { return obj.orgIdForRoom; }, set: function (obj, value) { obj.orgIdForRoom = value; } }, metadata: _metadata }, _orgIdForRoom_initializers, _orgIdForRoom_extraInitializers);
        __esDecorate(null, null, _orgIdForOther_decorators, { kind: "field", name: "orgIdForOther", static: false, private: false, access: { has: function (obj) { return "orgIdForOther" in obj; }, get: function (obj) { return obj.orgIdForOther; }, set: function (obj, value) { obj.orgIdForOther = value; } }, metadata: _metadata }, _orgIdForOther_initializers, _orgIdForOther_extraInitializers);
        __esDecorate(null, null, _cards_decorators, { kind: "field", name: "cards", static: false, private: false, access: { has: function (obj) { return "cards" in obj; }, get: function (obj) { return obj.cards; }, set: function (obj, value) { obj.cards = value; } }, metadata: _metadata }, _cards_initializers, _cards_extraInitializers);
        __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
        OrgImage = _classThis = _classDescriptor.value;
        if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        __runInitializers(_classThis, _classExtraInitializers);
    })();
    return OrgImage = _classThis;
}();
exports.OrgImage = OrgImage;
